package ac.il.technion.c236369.hw4.core.protocol;

import java.io.IOException;

import org.apache.http.HttpException;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.apache.http.protocol.HttpContext;
import org.apache.http.protocol.HttpRequestHandler;

import ac.il.technion.c236369.hw4.typehandlers.TypeHandler;

/**
 * @author Artem Barger, Maxim Aizenshtein
 *
 *	Class to handle specified request for files
 *  for them type handler is defined and loaded into 
 *  server's memory. 
 *
 */
public class SpecifiedRequetHandler implements HttpRequestHandler {

	
	private TypeHandler typeHandler;

	public SpecifiedRequetHandler( TypeHandler typeHandler) {
		this.typeHandler = typeHandler;
	}
	
	@Override
	public void handle(final HttpRequest request, HttpResponse response, HttpContext context)
			throws HttpException, IOException {
		//Delegate everything to outsource type handler
		typeHandler.handle(request, response, context);
	}

}
